<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>YZU资助管理系统</title>
    <script type="text/javascript" src="statics/js/jquery.min.js"></script>
	<script type="text/javascript" src="statics/js/rainbows.js"></script>
	<style type="text/css">
html {margin:0;padding:0;border:0;}body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;}body {line-height:1.5;background:white;}table {border-collapse:separate;border-spacing:0;}caption, th, td {text-align:left;font-weight:normal;float:none !important;}table, th, td {vertical-align:middle;}blockquote:before, blockquote:after, q:before, q:after {content:'';}blockquote, q {quotes:"" "";}a img {border:none;}:focus {outline:0;}
html {
	min-height: 100%;
}
body {
	height: 100%;
	position: relative;
	font-family: Arial, Helvetica, sans-serif;
	color: #888;
	font-size: 13px;
	line-height: 20px;
	min-width: 998px;
	border-top:3px solid #919191;
	background:url(statics/images/BG2.jpg) round;
}
#wrapper {	
	padding: 240px 0 0 0px;
	height: 100%;
	width: 400px;
	margin:auto;
}
#wrappertop {
	background:url(statics/images/wrapper_top.png) no-repeat;
	height:22px;
}

#wrappermiddle {
	background:url(statics/images/wrapper_middle.png) repeat-y;
	height:240px;
}

#wrapperbottom {
	background:url(statics/images/wrapper_bottom.png) no-repeat;
	height:22px;
}

#wrapper h2 {
	margin-left:20px;
	font-size:20px;
	font-weight:bold;
	font-family:Myriad Pro;
	text-transform:uppercase;
	text-shadow: #fff 2px 2px 2px;
}

#username_input {
	margin-left:25px;
	+margin-left:0px;
	position:absolute;
	margin-top:20px;
}

#username_inputleft {
	float:left;
	background:url(statics/images/input_left.png) no-repeat;
	width:12px;
	height:50px;
}

#username_inputmiddle {
	float:left;
	background:url(statics/images/input_middle.png) repeat-x;
	width:276px;
	height:50px;
}

#username_inputright {
	float:left;
	background:url(statics/images/input_right.png) no-repeat;
	width:12px;
	height:50px;
}

#loginName,#loginPwd{
	display:block;
	width:276px;
	height:45px;
	background:transparent;
	border:0;
	color:#bdbdbd;
	font-family:helvetica, sans-serif;
	font-size:14px;
	*padding-top:15px;
	padding-top:15px\0;
	padding-top:0px\9\0;
	padding-left:20px;
}

#url_user {
	position:absolute;
	display:block;
	margin-top:-28px;
	float:left;
	padding-right:10px;
}

#password_input {
	margin-left:25px;
	margin-top:80px;
}

#userType_select {
	margin-left:25px;
}

#password_inputleft {
	float:left;
	background:url(statics/images/input_left.png) no-repeat;
	width:12px;
	height:50px;
}

#password_inputmiddle {
	float:left;
	background:url(statics/images/input_middle.png) repeat-x;
	width:276px;
	height:50px;
}

#password_inputright {
	float:left;
	background:url(statics/images/input_right.png) no-repeat;
	width:12px;
	height:50px;
}

#url_password {
	display:block;
	margin-top:-32px;
	float:left;
	margin-left:4px;
}

#submit{
	float:left;
	position:relative;
	padding:0;
	margin-left:25px;
	margin-top:10px;
	width:300px;
	height:40px;
	border:0;
}

#submit1 {
	position:absolute;
	z-index: 10;
	border:0;
}

#submit2 {
	margin-top:0px;
	border:0;
}

#powered{
	float:right;
	position:relative;
	padding-top:3px;
	margin-right:5px;
	font-size:12px;
	color:#9ec44e;
}
	</style>
</head>
<body>
	<div id="wrapper">
		<div id="wrappertop"></div>
		<div id="wrappermiddle">
			<h2>请登录&nbsp;<span style="color:red;font-size:12px;margin-left:20px" id="errorInfo"></span></h2>
			<div id="username_input">
				<div id="username_inputleft"></div>
				<div id="username_inputmiddle">
					<div style="height:45px;"><input type="text" id="loginName" value="请输入用户名！" onclick="this.value = ''"></div>
					<img id="url_user" src="statics/images/mailicon.png" alt="">
				</div>
				<div id="username_inputright"></div>
			</div>
			<div id="password_input">
				<div id="password_inputleft"></div>
				<div id="password_inputmiddle">
					<div style="height:45px;"><input type="password" id="loginPwd" value="请输入密码！" onkeyDown="enterkey(event);" onclick="this.value = ''"></div>
					<img id="url_password" src="statics/images/passicon.png" alt="">
				</div>
				<div id="password_inputright"></div>
			</div>
			<div id="userType_select" style="margin-top:135px;">
				<div style="float:left;">用户类型：</div>
					<select id="userType">
						<option value="1">学生</option>
						<option value="2">发放员</option>
						<option value="3">内控人员</option>
						<option value="4">系统管理员</option>
					</select>
			</div>
			<div id="submit">
				<form>
				<input type="image" src="statics/images/submit_hover.png" id="submit1" value="Sign In">
				<input type="image" src="statics/images/submit.png" id="submit2" value="Sign In">
				</form>
			</div>
		</div>
		<div id="wrapperbottom"></div>
		<div id="powered">
		<!--<p>YZU资助管理系统欢迎您~</p>-->
		</div>
	</div>
</body>
<script>
	$(document).ready(function(){
		$("#submit1").hover(
			function() {$(this).animate({"opacity": "0"}, "slow");},
			function() {$(this).animate({"opacity": "1"}, "slow");});
		$("#submit1").click(formSubmit);
 	});

	function enterkey(e){
		var currKey=0,e=e||event;
		keyCode=e.keyCode||e.which||e.charCode;
	    try{
	        if(keyCode==13){
	        	formSubmit();
	        }
	    }catch(e){
	        return;
	    } 
	}

	function clickEnterKey(e) {
		var currKey=0,e=e||event;
		keyCode=e.keyCode||e.which||e.charCode;
	    try{
	        if(keyCode==13 || keyCode==32){
	        	formSubmit();
	        }
	    }catch(e){
	        return;
	    } 
	}

	function formSubmit() {
		var loginName = $.trim($("#loginName").val());
		var loginPwd = $.trim($("#loginPwd").val());
		if(loginName == '' || loginName == '请输入用户名！') {
			$('#errorInfo').html("请输入用户名！");
			$("#loginName").click().focus();
			return false;
		}
		
		if(loginPwd == '' || loginPwd == '请输入密码！') {
			$('#errorInfo').html("请输入密码！");
			$("#loginPwd").click().focus();
			return false;
		}

		$.post('user/login',{loginName:loginName,loginPwd:loginPwd,userType:$('#userType').val()},function(result) {
			if(result.errorInfo == 'none') {
				$('#errorInfo').html('登陆成功，正在转入...');
				window.location.href = 'index.html';
			} else {
				$('#errorInfo').html(result.errorInfo);
			}
		});

		return false;
	}
</script>
</html>